jQuery(document).ready(function() {
	/***** PIE CHART *****/

    var piedata = [
        { label: "Series 1", data: [[1,10]], color: '#D9534F'},
        { label: "Series 2", data: [[1,30]], color: '#1CAF9A'},
        { label: "Series 3", data: [[1,90]], color: '#F0AD4E'},
        { label: "Series 4", data: [[1,70]], color: '#428BCA'},
        { label: "Series 5", data: [[1,80]], color: '#5BC0DE'}
	 ];

    jQuery.plot('#piechart', piedata, {
        series: {
            pie: {
                show: true,
                radius: 1,
                label: {
                    show: true,
                    radius: 2/3,
                    formatter: labelFormatter,
                    threshold: 0.1
                }
            }
        },
        grid: {
            hoverable: true,
            clickable: true
        }
    });


	    function labelFormatter(label, series) {
		return "<div style='font-size:8pt; text-align:center; padding:2px; color:white;'>" + label + "<br/>" + Math.round(series.percent) + "%</div>";
	}

		/***** Bar CHART *****/
	var m3 = new Morris.Bar({
        // ID of the element in which to draw the chart.
        element: 'bar-chart',
        // Chart data records -- each entry in this array corresponds to a point on
        // the chart.
        data: [
            { y: '2006', a: 30,  b: 20,  c: 20 },
            { y: '2007', a: 75,  b: 65,  c: 65 },
            { y: '2008', a: 50,  b: 40,  c: 40 },
            { y: '2009', a: 75,  b: 65,  c: 65 },
            { y: '2010', a: 50,  b: 40,  c: 40 },
            { y: '2011', a: 75,  b: 65,  c: 65 },
            { y: '2012', a: 100, b: 90,  c: 90 }
        ],
        xkey: 'y',
        ykeys: ['a', 'b','c'],
        labels: ['Series A', 'Series B',"c"],
        lineWidth: '1px',
        fillOpacity: 0.8,
        smooth: false,
        hideHover: true
    });

});
